/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.helpdesk.dao;

import com.helpdesk.entidades.HdAreas;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
import javax.persistence.Query;

/**
 *
 * @author Manuel
 */
@Stateless
public class HdAreasFacade extends AbstractFacade<HdAreas> {
    @PersistenceContext(unitName = "WebAppHelpDeskPU")
    private EntityManager em;
    
    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public HdAreasFacade() {
        super(HdAreas.class);    
    }
    
    //public List<HdAreas> buscarPorDescripcion(String descripcion) {
    //Query q = em.createQuery("SELECT h FROM HdAreas h WHERE h.des_area LIKE :parametro");
    //q.setParameter("desArea", "%" + descripcion + "%");
    //return q.getResultList();
    
    public List<HdAreas> FilterByAreaDesc(HdAreas areas) {
    Query q=em.createNamedQuery("HdAreas.findByAreaDesc");
    q.setParameter("desArea", "%" + areas.getDesArea() + "%");
    return q.getResultList();
}
}
